/**
 * Project Name:sc-parent-service
 * File Name:ProbabilityCount.java
 * Package Name:com.sc.probabilitycount
 * Date:2018年6月29日上午9:10:21
 * Copyright (c) 2018, bluemobi All Rights Reserved.
 */

package com.sc.probabilitycount;

import java.util.List;

import com.sc.pojo.Customer;
import com.sc.probability.Probability;
import com.sc.probabilityfactory.ProbabilityFactory;

/**
 * Description:  这个是计算概率的第一版本，现在不用了   <br/>
 * Date:     2018年6月29日 上午9:10:21 <br/>
 * @author   tianyongxu
 * @version
 * @see
 */
public class ProbabilityCount {
     //創建一所有的計算概率的對象 
    @SuppressWarnings("null")
    public static List<Probability> createProbabilityObject(){
        List<Probability> listproProbabilitieObeject = null;
        listproProbabilitieObeject.add(ProbabilityFactory.createProbability(ProbabilityFactory.AGE));
        listproProbabilitieObeject.add(ProbabilityFactory.createProbability(ProbabilityFactory.ANNUALINCOME));
        listproProbabilitieObeject.add(ProbabilityFactory.createProbability(ProbabilityFactory.GENDER));
        listproProbabilitieObeject.add(ProbabilityFactory.createProbability(ProbabilityFactory.HASHOUSECOUNT));
        listproProbabilitieObeject.add(ProbabilityFactory.createProbability(ProbabilityFactory.MONEY));
        
        return listproProbabilitieObeject;
    }
    
    public static float countProbability(Customer customer){
        float countProbability = 0.0f;
        List<Probability> probabilityObject = ProbabilityCount.createProbabilityObject();
        for (int i = 0; i < probabilityObject.size(); i++) {
            countProbability += probabilityObject.get(i).getProbability(customer);
            
        }
        return countProbability;
    }
    
}

